﻿using System;
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;

namespace CID.Domain.Persistence.Conventions
{
    public class ReferenceConvention : IReferenceConvention
    {
        public void Apply(IManyToOneInstance instance)
        {
            instance.Not.Nullable();
            instance.ForeignKey(String.Format("FK_{0}_{1}", instance.EntityType.Name, instance.Class.Name));
        }
    }
}
